home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 27 / CDROM27.iso / share / progra / mai / Graphics, Tiling a Bitmap in a PictureBox < prev    next >
Encoding:
Text File  |  1997-07-13  |  1.1 KB  |  26 lines

  1. 'Description: Tiles a Bitmap in a PictureBox
  2.  
  3. 'Private Declare Function BitBlt Lib "GDI32" (ByVal hDestDC As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal nWid As Integer, ByVal nHt As Integer, ByVal hSrcDC As Integer, ByVal XSrc As Integer, ByVal YSrc As Integer, ByVal dwRop As Long) As Integer
  4.  
  5. 'Private Sub Tile(picParent As PictureBox, picTile As PictureBox)
  6. 'This subroutine tiles a picture onto another picture.
  7. 'call syntax: Tile Picture1, Picture2
  8. '             Tile (destination), (source)
  9. Dim TileIt As Integer
  10. Const SRCCOPY = &HCC0020
  11. Dim X As Integer, Y As Integer
  12. Dim MaximumX As Integer, MaximumY As Integer
  13. MaximumX = picParent.Width + picTile.Width
  14. MaximumY = picParent.Height + picTile.Height
  15. MaximumX = MaximumX \ Screen.TwipsPerPixelX
  16. MaximumY = MaximumY \ Screen.TwipsPerPixelY
  17. Dim TileWidth As Integer, TileHeight As Integer
  18. TileWidth = picTile.Width \ Screen.TwipsPerPixelX
  19. TileHeight = picTile.Height \ Screen.TwipsPerPixelY
  20. For Y = 0 To MaximumY Step TileHeight
  21.   For X = 0 To MaximumX Step TileWidth
  22.     TileIt = BitBlt(picParent.hDC, X, Y, TileWidth, TileHeight, picTile.hDC, 0, 0, SRCCOPY)
  23.   Next
  24. Next
  25. 'End Sub
  26.